<?php
$name=$_POST['name'];
$pass=$_POST['pass'];

$link=mysqli_connect('127.0.0.1','root','root','mi');


$sql="SELECT*FROM `login` WHERE `name`='$name' AND `pass`='$pass'";

$result=mysqli_query($link,$sql);

$arr=mysqli_fetch_assoc($result);

if($arr){
    $arr=array('code'=>1);
}else{
    $arr=array('code'=>0);
};

$jsonstr=json_encode($arr);
echo $jsonstr;
 
mysqli_close($link);

?>